/*
 * @Author: c.k
 * @Date: 2019-04-02 13:36:33
 * @Last Modified by: c.k
 * @Last Modified time: 2019-04-03 16:48:09
 */

import Url from "./url";
import Service from "./service";
// 接口前缀名称
const apiProfix = "http://pay.7c6nn.com/cpapis/";

export default {
  install(Vue) {
    let api = {};
    for (let u of Url) {
      let methods = u.methods || "post";
      // 所有接口前缀
      api[u.name] = data => Service[methods](apiProfix + u.url, data);
    }
    Vue.prototype.$api = api;
    Vue.$api = api;
  }
};
